/*
 *
 * Version 1.00
 * 
 * Created on 2007-6-4
 * Encoding UTF-8
 */
package net.comm.oper.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import net.comm.common.GlbFinal;
import net.comm.common.ReturnMessage;


import net.comm.oper.bean.BaseNotAdv;
import net.comm.oper.service.impl.NotAdvServiceImpl;
import net.comm.oper.web.form.NotAdvForm;
import net.comm.util.HtmlMessageBox;
import net.comm.util.StringUtil;
import net.comm.web.base.AbstractBaseAction;


/**
 *2.26	公告/通知/投诉/建议/留言Action
 * @author hcgong(hcgong@sina.com)
 * @version 1.0
 * @date 2007-6-4
 */
public class NotAdvAction extends AbstractBaseAction {
	
	private NotAdvServiceImpl service = null;
	
	/**
	 * struct-config中该ACTION中的每个forward的常量定义
	 */
	final String ADLIST_FORWARD = "adlist";
	final String ADOPER_FORWARD = "adoper";
	final String LIST_FORWARD = "list";
	final String FAQ_FORWARD = "faq";
	final String OPER_FORWARD = "oper";
	final String LOGIN_FORWARD = "loginFwd";	
	final String DETAIL_FORWARD = "detail";
	final String TSJYLIST_FORWARD = "tsjylist";
	
	/**
	 *构造方法
	 */
	public NotAdvAction()
	{
		super(false);
		
		/**
		 * 初始化业务组件接口
		 */
		service = new NotAdvServiceImpl();
	}
	
	/**
	 * 默认动作
	 * 1.action值为空的时候,进入查询页面
	 * 2.每个操作都执行的代码,但是方法必须返回null
	 * @param mapping	 跳转的mapping值	
	 * @param request	 HttpServletRequest对象
	 * @param response	 HttpServletResponse对象
	 */
	public ActionForward startAction(ActionMapping mapping, ActionForm form,
									 HttpServletRequest request , 
									 HttpServletResponse response)
	{
		String action = getReqParam(request , ACTION_KEY);
		if(action == null || action.trim().length() == 0) {
			return mapping.findForward(LIST_FORWARD);
		} else {
			return null;
		}
	}
	
	/**
	 * 查询清单
	 * @param mapping		跳转的mapping值		
	 * @param request		HttpServletRequest对象
	 * @param response		HttpServletResponse对象
	 * @return
	 * @throws Exception
	 */
	public ActionForward list(ActionMapping mapping, ActionForm form,
							  HttpServletRequest request , 
							  HttpServletResponse response) 
		throws Exception
	{
		/**
		 *定义一个查询bean保存查询页面提交的查询条件
		 */
		NotAdvForm theForm = (NotAdvForm)form;
			
		// 生成分页对象	
		theForm.setPage(this.getPageFromReq(request,40));
		
		ReturnMessage msg  = new ReturnMessage();
		
		/**
		 * 设置当前页面key和上页lastKey
		 */
		theForm.setLastKey(getReqParam(request, KEY));
		/**
		 *调用services中的方法
		 */
		List list = service.list(theForm , msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		/**
		 *设置列表的数据
		 */
		setAction(request, "list");
		request.setAttribute("notadvlist" , list);
		request.setAttribute("theForm", theForm);
		
		/**
		 * 设置分页对象,key,lastkey到request中
		 * 使用分页组件,必须设置这三个值
		 */
		request.setAttribute(PAGE_KEY , theForm.getPage());
		request.setAttribute(KEY , theForm.getKey());
		request.setAttribute(LAST_KEY , theForm.getLastKey());
		
		/**
		 * 转发到LIST_FORWARD指定的jsp文件
		 */
		return mapping.findForward(LIST_FORWARD);
	}
	/**
	 * 查询公告/通知/投诉/建议/留言清单
	 * @param mapping		跳转的mapping值		
	 * @param request		HttpServletRequest对象
	 * @param response		HttpServletResponse对象
	 * @return
	 * @throws Exception
	 */
	public ActionForward tsjylist(ActionMapping mapping, ActionForm form,
							  HttpServletRequest request , 
							  HttpServletResponse response) 
		throws Exception
	{
		/**
		 *定义一个查询bean保存查询页面提交的查询条件
		 */
		NotAdvForm theForm = (NotAdvForm)form;
			
		// 生成分页对象	
		theForm.setPage(this.getPageFromReq(request,40));
		
		ReturnMessage msg  = new ReturnMessage();
		
		/**
		 * 设置当前页面key和上页lastKey
		 */
		theForm.setLastKey(getReqParam(request, KEY));
		/**
		 *调用services中的方法
		 */
		List list = service.adlist(theForm , msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
		/**
		 *设置列表的数据
		 */
		setAction(request, "adlist");
		request.setAttribute("notadvlist" , list);
		request.setAttribute("theForm", theForm);

		/**
		 * 设置分页对象,key,lastkey到request中
		 * 使用分页组件,必须设置这三个值
		 */
		request.setAttribute(PAGE_KEY , theForm.getPage());
		request.setAttribute(KEY , theForm.getKey());
		request.setAttribute(LAST_KEY , theForm.getLastKey());
		
		/**
		 * 转发到LIST_FORWARD指定的jsp文件
		 */
		return mapping.findForward(TSJYLIST_FORWARD);
	}
	
	/**
	 * 查询公告/通知/投诉/建议/留言清单
	 * @param mapping		跳转的mapping值		
	 * @param request		HttpServletRequest对象
	 * @param response		HttpServletResponse对象
	 * @return
	 * @throws Exception
	 */
	public ActionForward adlist(ActionMapping mapping, ActionForm form,
							  HttpServletRequest request , 
							  HttpServletResponse response) 
		throws Exception
	{
		/**
		 *定义一个查询bean保存查询页面提交的查询条件
		 */
		NotAdvForm theForm = (NotAdvForm)form;
			
		// 生成分页对象	
		theForm.setPage(this.getPageFromReq(request,40));
		
		ReturnMessage msg  = new ReturnMessage();
		
		/**
		 * 设置当前页面key和上页lastKey
		 */
		theForm.setLastKey(getReqParam(request, KEY));
		/**
		 *调用services中的方法
		 */
		List list = service.adlist(theForm , msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
		/**
		 *设置列表的数据
		 */
		setAction(request, "adlist");
		request.setAttribute("notadvlist" , list);
		request.setAttribute("theForm", theForm);

		/**
		 * 设置分页对象,key,lastkey到request中
		 * 使用分页组件,必须设置这三个值
		 */
		request.setAttribute(PAGE_KEY , theForm.getPage());
		request.setAttribute(KEY , theForm.getKey());
		request.setAttribute(LAST_KEY , theForm.getLastKey());
		
		/**
		 * 转发到LIST_FORWARD指定的jsp文件
		 */
		return mapping.findForward(ADLIST_FORWARD);
	}
	/**
	 * 跳转到显示页面
	 */
	public ActionForward adaddPage(ActionMapping mapping, ActionForm form,
			 				 	 HttpServletRequest request , 
			 				 	 HttpServletResponse response)  
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
	
		Integer userID = (Integer)request.getSession().getAttribute(GlbFinal.SESSION_USERID);
		theForm.setUserID(userID);		
		
		theForm.setNsort(GlbFinal.NSORT_KEFU);
				
		request.setAttribute("theForm", theForm);

		return mapping.findForward(ADOPER_FORWARD);
	}
	
	/**
	 * 跳转到显示页面
	 */
	public ActionForward addPage(ActionMapping mapping, ActionForm form,
			 				 	 HttpServletRequest request , 
			 				 	 HttpServletResponse response)  
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
	
		Integer userID = (Integer)request.getSession().getAttribute(GlbFinal.SESSION_USERID);
		theForm.setUserID(userID);		
		
		request.setAttribute("theForm", theForm);

		return mapping.findForward(OPER_FORWARD);
	}

	/**
	 * 跳转到明细页面
	 */
	public ActionForward get(ActionMapping mapping, ActionForm form,
		 	 					HttpServletRequest request , 
		 	 					HttpServletResponse response) 
		throws Exception
	{

		/**
		 *定义数据封装类保存提交的数据
		 */
		ReturnMessage msg  = new ReturnMessage();
		NotAdvForm theForm = (NotAdvForm) form;
		
		service.get(theForm , msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			/**
			 * 出现错误,则调用如下方法把错误信息提示到客户端,该部分
			 * 是使用response.write方法把相关的html代码写到客户端浏览器
			 * 1.hmb.setAlertType 提示类型(对话框,页面.....)
			 * 2.hmb.setPrintMessage 提示显示的信息
			 * 3.hmb.setForwardUrl 提示后跳转的URL
			 */
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
	
		theForm.setAction(getReqParam(request, "action"));
		
		request.setAttribute("theForm" , theForm);
		
		return mapping.findForward(OPER_FORWARD);
	}	
	/**
	 * 跳转到明细页面
	 */
	public ActionForward detail(ActionMapping mapping, ActionForm form,
		 	 					HttpServletRequest request , 
		 	 					HttpServletResponse response) 
		throws Exception
	{

		/**
		 *定义数据封装类保存提交的数据
		 */
		ReturnMessage msg  = new ReturnMessage();
		NotAdvForm theForm = (NotAdvForm) form;
		// 生成分页对象	
		theForm.setPage(this.getPageFromReq(request,10));
		
		List list = service.adlist(theForm , msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		if(list.size() > 0){
			BaseNotAdv base = (BaseNotAdv)list.get(0);
			BeanUtils.copyProperties(theForm, base);
			
			//更新浏览次数
			NotAdvForm notadvform = new NotAdvForm();
			
			notadvform.setSeqID(theForm.getSeqID());
			notadvform.setFollID(0);
			notadvform.setAttachcnt(1);
			
			service.updsts(notadvform, msg);
			if(msg.getErrCode() !=0){
				
				HtmlMessageBox hmb = new HtmlMessageBox();
				hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
				hmb.setPrintMessage(msg.getMsg());
				hmb.setForwardUrl("javascript:history.go(-1)");
				return showMsg(hmb , request , response , mapping);
			}			
		}
		
		/**
		 *设置列表的数据
		 */
		setAction(request, "detail");
		request.setAttribute("notadvlist" , list);
		request.setAttribute("theForm", theForm);
		
		return mapping.findForward(DETAIL_FORWARD);
		
	}		
	/**
	 * 跳转到编辑页面
	 */
	public ActionForward modifyPage(ActionMapping mapping, ActionForm form,
							 	    HttpServletRequest request , 
							 	    HttpServletResponse response)
		throws Exception
	{
	
		return get(mapping , form, request , response);
	}	
	
	/**
	 *增加
	 */
	public ActionForward add(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
		ReturnMessage msg  = new ReturnMessage();
		
		String userName = request.getParameter("username");
		request.setAttribute("username", userName);
		
		String lajiliuyan = StringUtil.getValue((String)request.getSession().getAttribute(GlbFinal.LAJIMSG));
		if(lajiliuyan.equals("")){
			
			request.getSession().setAttribute(GlbFinal.LAJIMSG, theForm.getContent());
		}else if(lajiliuyan.trim().equals(theForm.getContent().trim())){
			
			msg.setMsg("请不要发送重复内容！");
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
	
		service.add(theForm, msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}

		String nexturl = "javascript:history.go(-1)";
		
		String ntype = theForm.getNtype();		
		String nosrt = theForm.getNsort();	
		//返回业委页面
		if(nosrt.equals("1") && (ntype.equals("5"))){
			nexturl = GlbFinal.FOLDER_INSTALL + "/yewei.do?action=home&yeweiID=" + theForm.getNsortID();
		} else if (nosrt.equals("2") && (ntype.equals("3")|| ntype.equals("4")||ntype.equals("5"))){
			//返回物业页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/wuye.do?action=home&wuyeID=" + theForm.getNsortID();
		} else if (nosrt.equals("4") && (ntype.equals("3") ||
				ntype.equals("4") ||ntype.equals("6"))){
			//返回客服页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/shenqing.do?action=faq";
		} else if (nosrt.equals("6") && (ntype.equals("5"))){
			//返回社区页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/shequ.do?action=home&villageID=" + theForm.getNsortID();
		} else if (theForm.getFollID() == 0 && (ntype.equals("1") ||ntype.equals("2"))){
			//返回公告、通知 列表页面
			nexturl = GlbFinal.FOLDER_INSTALL + 
			"/notadv.do?action=list&qryNtype=" + theForm.getNtype()+ 
			"&qryNsort="+ theForm.getNsort() +"&qryNsortID=" + theForm.getNsortID();
		} else if (theForm.getFollID() != 0 && (ntype.equals("1") ||ntype.equals("2"))){
			//返回公告、通知 页面
			nexturl = GlbFinal.FOLDER_INSTALL + 
			"/notadv.do?action=detail&qrySeqID=" + theForm.getSeqID();
		} else if (nosrt.equals("5") && (ntype.equals("5"))){
			//返回个人主页预览页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/users.do?action=home&userID=" + theForm.getNsortID();
		}else{
			nexturl = "javascript:history.go(-1)";
		}	
		
		msg.setMsg("处理成功！");
		HtmlMessageBox hmb = new HtmlMessageBox();
		hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
		hmb.setPrintMessage(msg.getMsg());
		hmb.setForwardUrl(nexturl);
		return showMsg(hmb , request , response , mapping);
		
	}
	/**
	 *增加
	 */
	public ActionForward adadd(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
		ReturnMessage msg  = new ReturnMessage();
		
		String lajiliuyan = StringUtil.getValue((String)request.getSession().getAttribute(GlbFinal.LAJIMSG));
		if(lajiliuyan.equals("")){
			
			request.getSession().setAttribute(GlbFinal.LAJIMSG, theForm.getContent());
		}else if(lajiliuyan.trim().equals(theForm.getContent().trim())){
			
			msg.setMsg("请不要发送重复内容！");
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
	
		service.add(theForm, msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		theForm.setQryNsort(theForm.getNsort());
		theForm.setQryNtype(theForm.getNtype());
		
		request.setAttribute("theForm", theForm);

		return adlist(mapping , form , request , response);
		
	}
	/**
	 *投诉会员
	 */
	public ActionForward toususer(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
		ReturnMessage msg  = new ReturnMessage();
		
		String lajiliuyan = StringUtil.getValue((String)request.getSession().getAttribute(GlbFinal.LAJIMSG));
		if(lajiliuyan.equals("")){
			
			request.getSession().setAttribute(GlbFinal.LAJIMSG, theForm.getContent());
		}else if(lajiliuyan.trim().equals(theForm.getContent().trim())){
			
			msg.setMsg("请不要发送重复内容！");
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
			
		service.toususer(theForm, msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
		String nexturl = GlbFinal.FOLDER_INSTALL + "/users.do?action=main" ;
		msg.setMsg("接受投诉，该会员已经被停用，等待客服人员处理！");
		HtmlMessageBox hmb = new HtmlMessageBox();
		hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
		hmb.setPrintMessage(msg.getMsg());
		hmb.setForwardUrl(nexturl);
		return showMsg(hmb , request , response , mapping);
	}	
	/**
	 *修改
	 */
	public ActionForward update(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;
		
		ReturnMessage msg  = new ReturnMessage();
		
		service.update(theForm, msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		
		String nexturl = GlbFinal.FOLDER_INSTALL + "/notadv.do?action=detail&qrySeqID="+ theForm.getSeqID();
		
		msg.setMsg("处理成功！");
		HtmlMessageBox hmb = new HtmlMessageBox();
		hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
		hmb.setPrintMessage(msg.getMsg());
		hmb.setForwardUrl(nexturl);
		return showMsg(hmb , request , response , mapping);
	}

	/**
	 *删除
	 */
	public ActionForward del(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;

		ReturnMessage msg  = new ReturnMessage();
		
		service.delall(theForm, msg);
		
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}
		String nexturl = "javascript:history.go(-1)";
		
		String ntype = theForm.getNtype();		
		String nsort = theForm.getNsort();	
		//返回业委页面
		if(nsort.equals("1") && (ntype.equals("5"))){
			nexturl = GlbFinal.FOLDER_INSTALL + "/yewei.do?action=home&yeweiID=" + theForm.getNsortID();
		} else if (nsort.equals("2") && (ntype.equals("3")|| ntype.equals("4")||ntype.equals("5"))){
			//返回物业页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/wuye.do?action=home&wuyeID=" + theForm.getNsortID();
		} else if (nsort.equals("4") && (ntype.equals("3") ||ntype.equals("4") ||ntype.equals("6"))){
			//返回客服页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/shenqing.do?action=faq";
		} else if (nsort.equals("6") && (ntype.equals("5"))){
			//返回社区页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/shequ.do?action=home&villageID=" + theForm.getNsortID();
		} else if (ntype.equals("1") ||ntype.equals("2")){
			//返回公告、通知 页面
			nexturl = GlbFinal.FOLDER_INSTALL + "/notadv.do?action=detail&qrySeqID=" + theForm.getSeqID();
		} else if (ntype.equals("5") && nsort.equals("5")){
			//返回个人主页
			nexturl = GlbFinal.FOLDER_INSTALL + "/users.do?action=main";
		}else{
			nexturl = "javascript:history.go(-1)";
		}	
		
		msg.setMsg("成功删除");
		HtmlMessageBox hmb = new HtmlMessageBox();
		hmb.setAlertType(HtmlMessageBox.ALERTTYPE_PRINTTOHTML);
		hmb.setPrintMessage(msg.getMsg());
		hmb.setForwardUrl(nexturl);
		return showMsg(hmb , request , response , mapping);
		
	}
	/**
	 *删除
	 */
	public ActionForward addel(ActionMapping mapping, ActionForm form,
							 HttpServletRequest request , 
							 HttpServletResponse response)
		throws Exception
	{
		NotAdvForm theForm = (NotAdvForm) form;

		ReturnMessage msg  = new ReturnMessage();
		
		service.delall(theForm, msg);
		if(msg.getErrCode() != GlbFinal.ERRCODE_SUCCESS) 
		{
			HtmlMessageBox hmb = new HtmlMessageBox();
			hmb.setAlertType(HtmlMessageBox.ALERTTYPE_CALLALERTMETHOD);
			hmb.setPrintMessage(msg.getMsg());
			hmb.setForwardUrl("javascript:history.go(-1)");
			return showMsg(hmb , request , response , mapping);
		}

		return adlist(mapping,form,request,response);
	}
}
